package cn.bulibuqi.myblog.bean;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import java.util.ArrayList;
import java.util.List;

/**
 * @author bulibuqi
 * @create 2021-12-14:05
 */
@Data
public class Tag {
    @TableId(type = IdType.AUTO)
    private Long id;
    @NotBlank(message = "标签名称不能为空") //会抛出异常
    private String name;

    @TableField(exist = false)
    private List<Blog> blogs = new ArrayList<>();


    public Tag(@NotBlank(message = "标签名称不能为空") String name) {
        this.name = name;
    }

    public Tag() {
    }
}
